import { ResPage, Role, ReqPage } from "@/api/interface/index";
import http from "@/api";

/**
 * @name 角色管理模块
 */
// * 获取角色列表
export const getRoleList = (params: ReqPage) => {
	return http.get<ResPage<Role.ResRoleList>>(`/role/find`, params);
};

// * 新增角色
export const addRole = (params: any) => {
	return http.post(`/role/add`, params);
};

// * 编辑角色
export const editRole = (params: any) => {
	return http.post(`/role/modify`, params);
};

// * 删除角色
export const deleteRole = (params: { id: string; ids?: string }) => {
	return http.post(`/role/remove`, params);
};

// * 获取角色菜单列表
export const getRoleMenuList = (roleId: string) => {
	return http.get<Menu.MenuOptionsRows>(`/role/menu/find`, { id: roleId }, { headers: { noLoading: true } });
};
